package StudentScore;

import java.util.Iterator;
import java.util.List;
public class Test {
    public static double getAvg(List<Student> list){
        double sum=0;
        Iterator<Student> it=list.iterator();
        while(it.hasNext() ){
            Student stu=it.next();
            sum+=stu.getsJava();

        }
        return sum/list.size();

    }
    public static Student getMax(List<Student> list){
        Iterator<Student> it=list.iterator();
        Student stuMax=it.next();
        for (Student stu: list){
            if(stu.getsJava()>stuMax.getsJava()){
                stuMax=stu;
            }
        }
        return stuMax;
    }
    public static Student getMin(List<Student>list) {
        Iterator<Student> it = list.iterator();
        Student stuMin=it.next();
        for (Student stu : list) {
            if (stu.getsJava()<stuMin.getsJava()) {
                stuMin=stu;
            }
        }
        return stuMin;
    }
}